{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=107
  Verdict: Accepted
}
uses SysUtils, Math;
 
var
	kk,ls,cls:int64;
	ans,s,cs:string;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
readln(s);
kk:=pos(' ',s);
if kk=0 then ans:=s else ans:=copy(s,1,kk-1);
ls:=length(ans);
while kk>0 do begin
	delete(s,1,kk);
	kk:=pos(' ',s);
	if kk=0 then cs:=s else cs:=copy(s,1,kk-1);
	cls:=length(cs);
	if cls>ls then begin
		ls:=cls;
		ans:=cs;
	end;
end;
writeln(ans);
write(ls);
end.